We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53742
    • 24 Posts
    I am trying to import data with the help of 'ImportX' Extra for MODX.
    When I set the 'publishedon' Field in my CSV file, ImportX somehow ignores it and writes zero ('0') to the database.

    My test CSV:
    menuindex;template;pagetitle;content;alias;publishedon;tv20;tv21
    558;7;Test News #4;<b>Test News #4!</b>;test-news-4;1360627200;1;1


    MySQL Workbench shows that in the column 'publishedon' for the new line is zero.

    Why? Is it an error (bug) of ImportX? Or am I doing something wrong?


    Thanks.

    This question has been answered by lkfranklin. See the first response.

    [ed. note: tester3 last edited this post 6 years, 7 months ago.]
      • 17301
      • 932 Posts
      The Published On date (the publishedon field in the database) is actually just a record of when the resource last changed from unpublished to published. The Published On field is set automatically when the resource changes from unpublished to published. This happens when either someone checks the "Published" checkbox and saves it, or the Publish On date is reached and the resource is published automatically.

      I could be wrong but my suggestion would be that you import your resources first, setting them to published via importx and then run importx again in update mode where you're updating the publishedon date.
        ■ email: [email protected] | ■ website: https://alienbuild.uk

        The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
        • 53742
        • 24 Posts
        hello to aliens laugh

        ok, i have looked in the database. id of the imported Resource is 265.

        i have created a 'update.csv':
        id;publishedon
        265;1360627200


        then i did this:
        MODX -> System Settings -> ImportX -> importx.processor
        'create' -> 'update'

        Now i start ImportX, give it the 'update.csv' and in the 'Default Settings' Tab select the same parent '193' as when I imported data.
        Now it argues:

        Console running...
        Attempted to set execution time to infinite. Max execution time currently: infinite.
        Running pre-import tests on submitted data...
        Data file upload overriding any manual input. Filename: update.csv
        No errors in pre-import found. Preparing import values...
        No errors found while checking the import values: 1 items found. Running import...
        PHP notice: Undefined index: pagetitle
        0 of 1 resources were imported successfully
        Error: uri: Resource 193 is already using the URI desktop/ru/о-компании/новости/2013/. Please enter a unique alias or use Freeze URI to manually override it. alias: Resource 193 is already using the URI desktop/ru/о-компании/новости/2013/. Please enter a unique alias or use Freeze URI to manually override it. alias: This field is required.

        'desktop/ru/о-компании/новости/2013/' is the alias-path of that Resource with ID=193.

        As of 1.1 you can change the importx.processor system setting from "create" to "update" to update resources based on the ID you pass along with the query. If the resource can't be find it will be created.
        https://docs.modx.com/extras/revo/importx
          • 17301
          • 932 Posts
          Try and import all the fields again, just with the addition of the ID. ImportX will only update the fields that are different anyway.
            ■ email: [email protected] | ■ website: https://alienbuild.uk

            The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
            • 53742
            • 24 Posts
            'test_2.csv' File:
            menuindex;template;pagetitle;content;alias;publishedon;tv20;tv21;id
            558;7;Test News #4;<b>Test News #4!</b>;test-news-4;1360627200;1;1;265


            the same parent id=193, no errors during update, but no changes in 'publishedon' field. zero again...
              • 53742
              • 24 Posts
              i have tried to manually set Resource's 'Published' flag to 'off', saved, then enabled it, saved. The 'publishedon' changed after this. Then i updated the Resource with the 'test_2.csv' file mentioned before, and now 'publishedon' is zero again. This means that ImportX intentionally zeroes this field. Maybe it is a bug?
              • discuss.answer
                • 17301
                • 932 Posts
                  ■ email: [email protected] | ■ website: https://alienbuild.uk

                  The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
                  • 53742
                  • 24 Posts
                  pity that such an old bug exists...

                  thanks, anyway smiley

                  'link_attributes' "hack" is very usefull. will try it.
                  • Did you try adding a "published" field set to 1 in your CSV? As I commented on that issue, the processors look at wether or not a resource is/should have been published when setting that field. So if you do not indicate that it is published, it may be nulling your publishedon value.

                    Basically, it seems you're saying "this resource was published on <date> but it's not published" and MODX doesn't agree with that logic.
                      Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                      Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                      • 53742
                      • 24 Posts
                      Mark, hello. No, i did not do that. Thanks for advice. Will try this.

                      P.S.

                      Actually, ImportX was setting published flag to 1 when i tried first time.